package cn.iocoder.yudao.module.biz.dal.mysql.emergencyReservePlainDrill;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.biz.controller.admin.emergencyReservePlainDrill.vo.BizEmergencyReservePlainDrillExportReqVO;
import cn.iocoder.yudao.module.biz.controller.admin.emergencyReservePlainDrill.vo.BizEmergencyReservePlainDrillPageReqVO;
import cn.iocoder.yudao.module.biz.dal.dataobject.emergencyReservePlainDrill.BizEmergencyReservePlainDrillDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 演练计划 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BizEmergencyReservePlainDrillMapper extends BaseMapperX<BizEmergencyReservePlainDrillDO> {

    default PageResult<BizEmergencyReservePlainDrillDO> selectPage(BizEmergencyReservePlainDrillPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizEmergencyReservePlainDrillDO>()
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getReservePlainId, reqVO.getReservePlainId())
                .likeIfPresent(BizEmergencyReservePlainDrillDO::getDrillName, reqVO.getDrillName())
                .likeIfPresent(BizEmergencyReservePlainDrillDO::getPlainName, reqVO.getPlainName())
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getType, reqVO.getType())
                .betweenIfPresent(BizEmergencyReservePlainDrillDO::getDrillTime, reqVO.getBeginDrillTime(), reqVO.getEndDrillTime())
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getAddress, reqVO.getAddress())
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getParticipant, reqVO.getParticipant())
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(BizEmergencyReservePlainDrillDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizEmergencyReservePlainDrillDO::getId));
    }

    default List<BizEmergencyReservePlainDrillDO> selectList(BizEmergencyReservePlainDrillExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizEmergencyReservePlainDrillDO>()
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getReservePlainId, reqVO.getReservePlainId())
                .likeIfPresent(BizEmergencyReservePlainDrillDO::getDrillName, reqVO.getDrillName())
                .likeIfPresent(BizEmergencyReservePlainDrillDO::getPlainName, reqVO.getPlainName())
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getType, reqVO.getType())
                .betweenIfPresent(BizEmergencyReservePlainDrillDO::getDrillTime, reqVO.getBeginDrillTime(), reqVO.getEndDrillTime())
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getAddress, reqVO.getAddress())
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getParticipant, reqVO.getParticipant())
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(BizEmergencyReservePlainDrillDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(BizEmergencyReservePlainDrillDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizEmergencyReservePlainDrillDO::getId));
    }
}
